<!DOCTYPE html>
<html><head>
<title>Vimrc</title>

<meta charset="utf-8">
<meta name="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta content="telephone=no" name="format-detection">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta name="theme-color" content="#ffffff">




<script src="/vendor/js/jquery.min.js" ></script>
<script src="/vendor/js/popper.min.js" ></script>
<script src="/vendor/js/bootstrap.min.js" ></script>
<script src="/vendor/js/smooth-scroll.polyfills.min.js" ></script>
<link type="text/css" rel="stylesheet" href="/vendor/css/bootstrap.min.css">
<script src="/vendor/js/vue.min.js" ></script>




<link rel="stylesheet" href="https://dillyant.gitee.io/scss/journal.min.47aa1ffb60880ad8c72feecd6962a14331eca7a7a30e08354a1ca91009b8bc5b.css" integrity="sha256-R6of&#43;2CICtjHL&#43;7NaWKhQzHsp6ejDgg1ShypEAm4vFs=" media="screen">



<link rel="stylesheet" href="https://dillyant.gitee.io/scss/dark-mode.min.b13808e7c98cd5aa981a3822fd3421e26f1015876bb15a3fbf8ed5991c382367.css" integrity="sha256-sTgI58mM1aqYGjgi/TQh4m8QFYdrsVo/v47VmRw4I2c=" media="screen">


<script src="https://dillyant.gitee.io//js/loadCSS.js"></script>
<script>
  loadCSS("https://fonts.googleapis.com/css?family=Lora|Montserrat|Fira+Mono|Noto+Serif+SC|Material+Icons");
</script>

<script src="https://dillyant.gitee.io//js/table.js"></script>




<script src="https://dillyant.gitee.io//js/toc.js"></script>



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script src="/vendor/js/md5.min.js"></script>
<script>
  var gitalk = new Gitalk({
  clientID: 'your client id',
  clientSecret: 'your client secret',
  repo: 'repo name',
  owner: 'user',
  admin: ['user'],
  id: md5(location.pathname),
  distractionFreeMode: 'false'
  });
  window.onload = function () {
        gitalk.render('gitalk-container')
  }
</script>








</head><body>
    	<div id="app"><div ref="sideContainer" class="side-container">
    
    <a class="a-block nav-head false" href="https://dillyant.gitee.io/">
    
        <div class="nav-title">
            dillyant&#39;s world
        </div>
        
        <div class="nav-subtitle">
            O(∩_∩)O
        </div>
        
    </a>

    <div class="nav-link-list">
        
        
            
            
            
                
            
            
            
            <a class="a-block nav-link-item active" href="/post">
                归档
            </a>
            
        
            
            
            
            
            
            <a class="a-block nav-link-item false" href="/categories">
                分类
            </a>
            
        
            
            
            
            
            
            <a class="a-block nav-link-item false" href="/tags">
                标签
            </a>
            
        
            
            
            
            
            
            <a class="a-block nav-link-item false" href="/index.xml">
                RSS
            </a>
            
        
            
            
            
            
            
            <a class="a-block nav-link-item false" href="/about/">
                关于
            </a>
            
        
    </div>

    

    <div class="nav-footer">
        
Hugo Theme <a href="https://github.com/amazingrise/hugo-theme-diary">Diary</a> by <a href="https://amazingrise.net">Rise</a>
<br>
Ported from <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopener">Makito</a>'s <a href="https://github.com/SumiMakito/hexo-theme-journal/" target="_blank" rel="noreferrer noopener">Journal.</a> <br>
<br>

&copy;
	
	dillyant copyright.
	

    </div>
    
</div><div ref="extraContainer" class="extra-container">
    
    
    <div class="toc animated-visibility" :class="{ invisible: scrollY <= 140 }">


</div>
    
    <div class="pagination">
        <a id="globalBackToTop" class="pagination-action animated-visibility" href="#top" :class="{ invisible: scrollY == 0 }">
            <i class="material-icons pagination-action-icon">
                keyboard_arrow_up
            </i>
        </a>
        
        <a class="pagination-action" v-on:click="toggleDarkMode">
            <i class="material-icons pagination-action-icon" v-if="isDarkMode">
                brightness_4
            </i>
            <i class="material-icons pagination-action-icon" v-else="isDarkMode">
                brightness_7
            </i>
        </a>
        
        
    </div>
</div><div class="single-column-drawer-container" ref="drawer"
     v-bind:class="{ 'single-column-drawer-container-active': isDrawerOpen }">
    <div class="drawer-content">
        <div class="drawer-menu">
            
            
            
                
                
                
                    
                
                
                
                <a class="a-block drawer-menu-item active" href="/post">
                    归档
                </a>
                
            
                
                
                
                
                
                <a class="a-block drawer-menu-item false" href="/categories">
                    分类
                </a>
                
            
                
                
                
                
                
                <a class="a-block drawer-menu-item false" href="/tags">
                    标签
                </a>
                
            
                
                
                
                
                
                <a class="a-block drawer-menu-item false" href="/index.xml">
                    RSS
                </a>
                
            
                
                
                
                
                
                <a class="a-block drawer-menu-item false" href="/about/">
                    关于
                </a>
                
            
            
            <div class="toc">


</div>
            
        </div>
    </div>
</div>
<transition name="fade">
    <div v-bind:class="{ 'single-column-drawer-mask': mounted }" v-if="isDrawerOpen" v-on:click="toggleDrawer"></div>
</transition>
<nav ref="navBar" class="navbar sticky-top navbar-light single-column-nav-container">
    <div ref="navBackground" class="nav-background"></div>
    <div class="container container-narrow nav-content">
        <button id="nav_dropdown_btn" class="nav-dropdown-toggle" type="button" v-on:click="toggleDrawer">
            <i class="material-icons">
                menu
            </i>
        </button>
        <a ref="navTitle" class="navbar-brand" href="https://dillyant.gitee.io/">
            dillyant&#39;s world
        </a>
        
        <button type="button" class="nav-darkmode-toggle" v-on:click="toggleDarkMode">
            <i class="material-icons" v-if="isDarkMode">
                brightness_4
            </i>
            <i class="material-icons" v-else="isDarkMode">
                brightness_7
            </i>
        </button>
        
    </div>
</nav>
<div class="single-column-header-container" ref="pageHead"
     v-bind:style="{ transform: 'translateZ(0px) translateY('+.3*scrollY+'px)', opacity: 1-navOpacity }">
    <a href="https://dillyant.gitee.io/">
        <div class="single-column-header-title">dillyant&#39;s world</div>
        
        <div class="single-column-header-subtitle">O(∩_∩)O</div>
        

    </a>
</div>
            <div id="content">
<div ref="streamContainer" class="stream-container">
    <div class="post-list-container post-list-container-shadow">
        <div class="post">
            
            
            

            <div class="post-head-wrapper-text-only"
                
            >
                <div class="post-title">
                    Vimrc
                    
                    <div class="post-meta">
                        
                        <time itemprop="datePublished">
                            2020-05-26 11:41
                        </time>
                        

                        
                            <i class="material-icons" style="">folder</i>
                                <a href="/categories/">[vim]</a>
                                &nbsp;
                        

                        
                            <i class="material-icons" style="">label</i>
                            
                                <a href="/tags/vimrc">vimrc</a>
                                &nbsp;
                            
                        
                        
                    </div>
                </div>
            </div>
            
            <div class="post-body-wrapper">
                <div class="post-body">
                    <pre><code>if empty(glob('~/.vim/autoload/plug.vim'))
	silent !curl -fkLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
	autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif


&quot;*****************************************************
&quot;                                                    *
&quot;       general配置                                  *
&quot;                                                    *
&quot;*****************************************************
&quot; With a map leader it's possible to do extra key combinations
&quot; like &lt;leader&gt;w saves the current file
&quot; If &quot;mapleader&quot; is not set or empty, a backslash is used  instead.
let mapleader = &quot;,&quot;
let g:mapleader = &quot;,&quot;

set t_Co=256

set ttymouse=xterm2
&quot; Switch syntax highlighting on, when the terminal has colors
syntax enable

&quot;允许未保存切换buffer 隐藏buff
set hidden

&quot;可以在buffer的任何地方使用鼠标
&quot;set mouse=a
&quot;set selection=exclusive
&quot;set selectmode=mouse,key

&quot;复制之前的缩进
set copyindent

&quot;Threshold for reporting number of lines changed
set report=0

&quot; Set to auto read when a file is changed from the outside
set autoread

&quot;Write the contents of the file, if it has been modified
set autowrite

&quot;显示行号
set number
&quot;set relativenumber

set ttyfast

&quot;历史记录数
set history=1000

&quot;Always show current position
set ruler

&quot;show (partial) command keys in the status line
set showcmd

&quot;Height of the command bar
set cmdheight=2

&quot; Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=b,s,&lt;,&gt;,[,],h,l

&quot;带有如下符号的单词不要换行分割
set iskeyword+=$,@,%,#

&quot; Ignore case when searching
set ignorecase

&quot; When searching try to be smart about cases
set smartcase

&quot; Highlight search results
set hlsearch

&quot; Makes search act like search in modern browsers
set incsearch

&quot; Don't redraw while executing macros (good performance config)
set lazyredraw

&quot; For regular expressions turn magic on
set magic

&quot; Show matching brackets when text indicator is over them
set showmatch

&quot;匹配括号高亮的时间（单位是十分之一秒）
set matchtime=1

&quot;匹配括号的规则，增加针对html的&lt;&gt;
set matchpairs=(:),{:},[:],&lt;:&gt;

&quot; No annoying sound on errors
set noerrorbells

&quot; no visualbell
set novisualbell

&quot; Add a bit extra margin to the left
set foldcolumn=1

&quot;在处理未保存或只读文件的时候，弹出确认
set confirm

&quot;设置光标高亮显示
&quot;set cursorline
&quot;set cursorcolumn

&quot;光标移动到buffer的顶部和底部时保持3行距离
set scrolloff=3

&quot; Always show the status line
set laststatus=2
&quot;set statusline=%F%m%r%h%w\ [FORMAT=%{&amp;ff}:%{&amp;fenc!=''?&amp;fenc:&amp;enc}]\ [TYPE=%Y]\ [ROW=%03l/%L(%p%%)]\ [COL=%03v]

&quot;Set utf8 as standard encoding
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
&quot;gb2312
&quot;set termencoding=gb2312
&quot;set fileencoding=gb2312
&quot;cp936 = gb2312
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1

&quot; Use spaces instead of tabs, 1 tab == 4 spaces
&quot;set expandtab
set smarttab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround

&quot;自动换行
set wrap
set cindent
set autoindent
set smartindent

&quot;字符间插入的像素数目
set linespace=0

&quot;增强模式中的命令行自动完成操作
set wildmenu

&quot; Remember info about open buffers on close
set viminfo^=%

&quot; Turn backup off, since most stuff is in SVN, git et.c anyway...
set noswapfile

&quot; Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
			\ if line(&quot;'\&quot;&quot;) &gt; 0 &amp;&amp; line(&quot;'\&quot;&quot;) &lt;= line(&quot;$&quot;) |
			\   exe &quot;normal! g`\&quot;&quot; |
			\ endif

&quot; :W sudo saves the file
&quot; (useful for handling the permission-denied error)
command W w !sudo tee % &gt; /dev/null

&quot; Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk

&quot; 快速保存
inoremap jk &lt;esc&gt;:w&lt;cr&gt;

&quot; 快速缩进
vnoremap &lt; &lt;gv
vnoremap &gt; &gt;gv

&quot; Disable highlight when &lt;leader&gt;&lt;cr&gt; is pressed
map &lt;silent&gt; &lt;leader&gt;&lt;cr&gt; :noh&lt;cr&gt;

&quot; Opens a new tab with the current buffer's path
&quot; Super useful when editing files in the same directory
map &lt;leader&gt;te :tabedit &lt;c-r&gt;=expand(&quot;%:p:h&quot;)&lt;cr&gt;/

&quot; Toggle paste mode on and off
map &lt;leader&gt;pp :setlocal paste!&lt;cr&gt;

&quot;ROT13 encrypt
map &lt;F12&gt; ggVGg?


&quot; Remove the Windows ^M - when the encodings gets messed up
noremap &lt;leader&gt;m mmHmt:%s/&lt;C-V&gt;&lt;cr&gt;//ge&lt;cr&gt;'tzt'm


&quot;*****************************************************
&quot;                                                    *
&quot;       vim-plug配置                                 *
&quot;                                                    *
&quot;*****************************************************

call plug#begin('~/.vim/plugged')

&quot;配色方案
Plug 'morhetz/gruvbox'
Plug 'flazz/vim-colorschemes'

&quot;显示函数原型
Plug 'vim-scripts/echofunc.vim'

&quot;文本对象组合使用能让更改成对的符号异常方便
&quot;Plug 'tpope/vim-surround'

&quot;markdown
&quot;Plug 'suan/vim-instant-markdown', {'for': 'markdown'}

&quot;代码模板
Plug 'vim-scripts/c.vim'
&quot;Plug 'SirVer/ultisnips'

&quot;符号列表
Plug 'vim-scripts/taglist.vim'
Plug 'vim-scripts/Tagbar'

&quot;头文件和源文件跳转
Plug 'vim-scripts/a.vim'

&quot;模糊查找
&quot;Plug 'Yggdroot/LeaderF'

&quot;状态栏
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
&quot;Plug 'Lokaltog/vim-powerline'

&quot;代码高亮
Plug 'octol/vim-cpp-enhanced-highlight'

&quot;代码注释
Plug 'scrooloose/nerdcommenter'

&quot;补全
Plug 'vim-scripts/OmniCppComplete'
&quot;Plug 'ycm-core/YouCompleteMe'
&quot;Plug 'Raimondi/delimitMate'

&quot;树形目录
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
Plug 'jistr/vim-nerdtree-tabs'
&quot;Plug 'fholgado/minibufexpl.vim'

&quot;版本控制
&quot;Plug 'mhinz/vim-signify'
&quot;Plug 'Xuyuanp/nerdtree-git-plugin'

&quot;代码检测
&quot;Plug 'dense-analysis/ale'

&quot;快速跳转
&quot;Plug 'justinmk/vim-sneak'

&quot;多光标
&quot;Plug 'terryma/vim-multiple-cursors'

&quot;tags管理
Plug 'ludovicchabant/vim-gutentags'
Plug 'skywind3000/gutentags_plus'
Plug 'skywind3000/vim-preview'

&quot;格式化
&quot;Plug 'godlygeek/tabular'
&quot;Plug 'junegunn/vim-easy-align'
Plug 'Chiel92/vim-autoformat'

call plug#end()


&quot;*****************************************************
&quot;                                                    *
&quot;       colorscheme配置                                     *
&quot;                                                    *
&quot;*****************************************************
&quot;colorscheme atom
colorscheme molokai
&quot;colorscheme luna-term
&quot;
&quot;colorscheme gruvbox
&quot;let g:gruvbox_contrast_light=&quot;light&quot;
&quot;let g:gruvbox_contrast_dark=&quot;hard&quot;
&quot;let g:gruvbox_improved_warnings=1


&quot;*****************************************************
&quot;                                                    *
&quot;       tags配置                                     *
&quot;                                                    *
&quot;*****************************************************
&quot;ctags -I __THROW -I __attribute_pure__ -I __nonnull -I __attribute__ --if0=yes --languages=c,c++ --c-kinds=+p --c++-kinds=+p --fields=+iaS --extras=+q -R -f ~/.vim/systags /usr/include /usr/local/include

&quot;//;不可省略 表示当前目录不存在tags，则在父目录中寻找
set tags=tags;
set tags+=/root/.vim/systags
set path+=/usr/include,/usr/local/include/

&quot;map &lt;F4&gt; :!ctags -R --languages=c,c++ --c-kinds=+p --c++-kinds=+p --fields=+iaS --extra=+q &lt;cr&gt;

&quot;*****************************************************
&quot;                                                    *
&quot;       Cscope配置                                   *
&quot;                                                    *
&quot;*****************************************************
if has(&quot;cscope&quot;)
	&quot; 指定用来执行cscope的命令
	&quot;set csprg=/usr/bin/cscope 
	&quot; 指定用来执行cscope的命令
	set csprg=/usr/bin/gtags-cscope 
	&quot; 设置cstag命令查找次序：0先找cscope数据库再找标签文件；1先找标签文件再找cscope数据库
	set csto=1 
	&quot; 同时搜索cscope数据库和标签文件
	set cst 
	&quot; 使用QuickFix窗口来显示cscope查找结果
	set cscopequickfix=s-,c-,d-,i-,t-,e-,a- 
endif

&quot;*****************************************************
&quot;                                                    *
&quot;       NERDCommenter配置                            *
&quot;                                                    *
&quot;*****************************************************
&quot;&lt;leader&gt;cc 注释当前选中文本
&quot;&lt;leader&gt;cu 取消选中文本块的注释。
&quot;&lt;leader&gt;cm 只用一组符号注释
&quot;&lt;leader&gt;cA 在行尾添加注释
&quot;&lt;leader&gt;c$ /* 注释 */
&quot;&lt;leader&gt;cs /* 块注释 */
&quot;&lt;leader&gt;cy 注释并复制
&quot;&lt;leader&gt;c&lt;space&gt; 注释/取消注释
&quot;&lt;leader&gt;ca 切换　// 和 /* */
let g:NERDSpaceDelims = 1
let g:NERDDefaultAlign = 'left'
let g:NERDCustomDelimiters = {
			\ 'javascript': { 'left': '//', 'leftAlt': '/**', 'rightAlt': '*/' },
			\ 'less': { 'left': '/**', 'right': '*/' }
			\ }

&quot;*****************************************************
&quot;                                                    *
&quot;    scrooloose/nerdtree                             *
&quot;                                                    *
&quot;*****************************************************
nmap &lt;leader&gt;nt :NERDTreeToggle&lt;cr&gt;
map &lt;left&gt; &lt;ESC&gt;:NERDTreeToggle&lt;RETURN&gt;
let NERDTreeChDirMode=2
let NERDTreeWinSize=35
let NERDTreeShowBookmarks=1
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1
let NERDTreeShowLineNumbers=1
let NERDTreeHighlightCursorline=1
let NERDTreeWinPos=&quot;left&quot;
let NERDTreeIgnore=[ '\.pyc$', '\.pyo$', '\.obj$', '\.o$', '\.so$', '\.egg$', '^\.git$', '^\.svn$', '^\.hg$', '\~$', '\.swp$']

let g:NERDTreeShowIgnoredStatus = 1
let g:nerdtree_tabs_open_on_console_startup=1
let g:NERDTreeIndicatorMapCustom = {
			\ &quot;Modified&quot;  : &quot;✹&quot;,
			\ &quot;Staged&quot;    : &quot;✚&quot;,
			\ &quot;Untracked&quot; : &quot;✭&quot;,
			\ &quot;Renamed&quot;   : &quot;➜&quot;,
			\ &quot;Unmerged&quot;  : &quot;═&quot;,
			\ &quot;Deleted&quot;   : &quot;✖&quot;,
			\ &quot;Dirty&quot;     : &quot;✗&quot;,
			\ &quot;Clean&quot;     : &quot;✔︎&quot;,
			\ 'Ignored'   : '☒',
			\ &quot;Unknown&quot;   : &quot;?&quot;
			\ }


&quot;*****************************************************
&quot;                                                    *
&quot;       taglist配置                                  *
&quot;                                                    *
&quot;*****************************************************
nmap &lt;leader&gt;tl :Tlist&lt;CR&gt;&lt;c-l&gt;
map &lt;right&gt; &lt;ESC&gt;:Tlist&lt;RETURN&gt;
let Tlist_Ctags_Cmd=&quot;ctags&quot;
&quot; 只显示当前文件的tags
let Tlist_Show_One_File        = 1             
&quot; 非当前文件，自动折叠
let Tlist_File_Fold_Auto_Close = 1             
&quot; 在右侧窗口中显示
let Tlist_Use_Right_Window     = 1             
&quot;tems in tags sorted by name
let Tlist_Sort_Type = &quot;name&quot;                  
&quot; 如果Taglist窗口是最后一个窗口则退出Vim
let Tlist_Exit_OnlyWindow      = 1             
&quot;实时更新tags
let Tlist_Process_File_Always  = 1
let Tlist_Inc_Winwidth = 0                     
let Tlist_Show_Menu=1
let Tlist_Use_SingleClick=0
let Tlist_Process_File_Always=1
let Tlist_GainFocus_On_ToggleOpen = 1

&quot;*****************************************************
&quot;                                                    *
&quot;       tagbar配置                                   *
&quot;                                                    *
&quot;*****************************************************
&quot;&lt;leader&gt;tb 打开tagbar窗口
nmap &lt;leader&gt;tb :TagbarToggle&lt;CR&gt;
let g:tarbar_width=35
let g:tagbar_autofocus = 1

&quot;*****************************************************
&quot;                                                    *
&quot;       a.vim配置                                    *
&quot;                                                    *
&quot;*****************************************************
&quot;切换源文件头文件 a.vim
&quot;:A 在同一tab切换源文件/头文件
&quot;:AV 竖向切割窗口,打开对应的源文件/头文件
&quot;:AS 横向切割窗口,打开对应的源文件/头文件

&quot;*****************************************************
&quot;                                                    *
&quot;       echofunc配置                                 *
&quot;                                                    *
&quot;*****************************************************
let g:EchoFuncKeyNext='&lt;leader&gt;n'
let g:EchoFuncKeyPrev='&lt;leader&gt;p'
let g:EchoFuncAutoStartBalloonDeclaration = 1


&quot;*****************************************************
&quot;                                                    *
&quot;        omnicppcomplete配置                         *
&quot;                                                    *
&quot;*****************************************************
set completeopt=menuone,menu,longest
let OmniCpp_MayCompleteDot = 1 &quot; autocomplete with .
let OmniCpp_MayCompleteArrow = 1 &quot; autocomplete with -&gt;
let OmniCpp_MayCompleteScope = 1 &quot; autocomplete with ::
let OmniCpp_NamespaceSearch = 0 &quot; search namespaces in this and included files
let OmniCpp_ShowPrototypeInAbbr = 1 &quot; show function prototype in popup window
let OmniCpp_DisplayMode=1 &quot; Class scope completion mode: always show all members
let OmniCpp_ShowScopeInAbbr=1 &quot; show scope in abbreviation and remove the last column
let OmniCpp_DefaultNamespaces = [&quot;std&quot;, &quot;gapnet&quot;]


&quot;*****************************************************
&quot;                                                    *
&quot;        vim-airline                                     *
&quot;                                                    *
&quot;*****************************************************
&quot;let g:airline_theme='papercolor'
&quot;let g:airline_theme=&quot;ravenpower&quot;
&quot;let g:airline_theme=&quot;minimalist&quot;
let g:airline_theme=&quot;kolor&quot;
&quot; let g:airline_theme=&quot;jellybeans&quot;
&quot; let g:airline_theme=&quot;distinguished&quot;
&quot; let g:airline_theme=&quot;base16_google&quot;
&quot; let g:airline_theme=&quot;behelit&quot;
&quot;


&quot;*****************************************************
&quot;                                                    *
&quot;   vim-instant-markdown                             *
&quot;                                                    *
&quot;*****************************************************

&quot;let g:instant_markdown_slow = 1
&quot;let g:instant_markdown_autostart = 0


&quot;*****************************************************
&quot;                                                    *
&quot;  tabular                                           *
&quot;                                                    *
&quot;*****************************************************
&quot; 冒号对齐：:Tab /:
&quot; 逗号对齐 :Tabularize /,
&quot; 运行上一个对齐命令 :Tab
&quot; // 对齐（需要 escape）: :Tab /\/\/

&quot;*****************************************************
&quot;                                                    *
&quot;  vim-easy-align                                    *
&quot;                                                    *
&quot;*****************************************************
&quot;xmap ga &lt;Plug&gt;(EasyAlign)
&quot;nmap ga &lt;Plug&gt;(EasyAlign)

&quot;*****************************************************
&quot;                                                    *
&quot;  dense-analysis/ale								 *
&quot;                                                    *
&quot;*****************************************************
&quot; 对应语言需要安装相应的检查工具
&quot;    let g:ale_linters_explicit = 1 &quot;除g:ale_linters指定，其他不可用
&quot;    let g:ale_linters = {
&quot;\   'cpp': ['cppcheck','clang','gcc'],
&quot;\   'c': ['cppcheck','clang', 'gcc'],
&quot;\   'python': ['pylint'],
&quot;\   'bash': ['shellcheck'],
&quot;\   'go': ['golint'],
&quot;\}
&quot;
&quot;let g:ale_sign_column_always = 1
&quot;let g:ale_completion_delay = 500
&quot;let g:ale_echo_delay = 20
&quot;let g:ale_lint_delay = 500
&quot;let g:ale_echo_msg_format = '[%linter%] %code: %%s'
&quot;let g:ale_lint_on_text_changed = 'normal'
&quot;let g:ale_lint_on_insert_leave = 1
&quot;let g:airline#extensions#ale#enabled = 1
&quot;&quot;let g:ale_set_quickfix = 1
&quot;&quot;let g:ale_open_list = 1&quot;打开quitfix对话框
&quot;
&quot;let g:ale_c_gcc_options = '-Wall -O2 -std=c99'
&quot;let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++14'
&quot;let g:ale_c_cppcheck_options = ''
&quot;let g:ale_cpp_cppcheck_options = ''
&quot;
&quot;let g:ale_sign_error = &quot;&gt;&gt;&quot;
&quot;let g:ale_sign_warning = &quot;--&quot;

&quot;*****************************************************
&quot; vim-gutentags                                      
&quot; 此插件需要单独安装ctags 和 gtags
&quot; ctags:  https://github.com/universal-ctags/ctags
&quot; gtags: https://www.gnu.org/software/global/download.html
&quot;************************************************************
&quot; 将自动生成的 tags 文件全部放入 ~/.cache/tags 目录中，避免污染工程目录
let s:vim_tags = expand('~/.cache/tags')
let g:gutentags_cache_dir = s:vim_tags

&quot; 检测 ~/.cache/tags 不存在就新建
if !isdirectory(s:vim_tags)
	silent! call mkdir(s:vim_tags, 'p')
endif
&quot;在项目根目录 touch 一个空的名为 .root 的文件
&quot; gutentags 搜索工程目录的标志，当前文件路径向上递归直到碰到这些文件/目录名
let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project']

&quot; 所生成的数据文件的名称
let g:gutentags_ctags_tagfile = '.tags'

&quot; 同时开启 ctags 和 gtags 支持：
let g:gutentags_modules = []
if executable('ctags')
	let g:gutentags_modules += ['ctags']
endif
if executable('gtags-cscope') &amp;&amp; executable('gtags')
	let g:gutentags_modules += ['gtags_cscope']
endif

&quot; 配置 ctags 的参数
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']

&quot; 如果使用 universal ctags 需要增加下面一行
let g:gutentags_ctags_extra_args += ['--output-format=e-ctags']

&quot; 禁用 gutentags 自动加载 gtags 数据库的行为
let g:gutentags_auto_add_gtags_cscope = 0

&quot; change focus to quickfix window after search (optional).
let g:gutentags_plus_switch = 1

&quot;预览 quickfix 窗口 ctrl-w z 关闭
&quot;往上滚动预览窗口
noremap &lt;Leader&gt;u :PreviewScroll -1&lt;cr&gt;
&quot;往下滚动预览窗口
noremap &lt;leader&gt;d :PreviewScroll +1&lt;cr&gt;
&quot;打开预览窗口
autocmd FileType qf nnoremap &lt;silent&gt;&lt;buffer&gt; p :PreviewQuickfix&lt;cr&gt;
autocmd FileType qf nnoremap &lt;silent&gt;&lt;buffer&gt; P :PreviewClose&lt;cr&gt;

&quot;*****************************************************
&quot;                                                    *
&quot; Yggdroot/LeaderF									 *
&quot;                                                    *
&quot;*****************************************************
&quot; Ctrl + p 打开文件搜索
let g:Lf_ShortcutF = '&lt;c-f&gt;'
&quot; 打开函数列表
noremap &lt;leader&gt;lf :LeaderfFunction&lt;cr&gt;


&quot;*****************************************************
&quot;                                                    *
&quot; vim-autoformat                                     *
&quot;                                                    *
&quot;*****************************************************

noremap &lt;leader&gt;af :Autoformat&lt;CR&gt;:w&lt;CR&gt;
&quot;写入时自动格式化
&quot;au BufWrite * :Autoformat

&quot;debug mode
let g:autoformat_verbosemode=1

let g:formatters_cpp = ['my_custom_cpp']
let g:formatdef_my_custom_cpp = '&quot;astyle --mode=c --style=kr -T4 -N -U -y -p -xg -H -k3 -j -xb -m0 -M40 -n -xC100\&lt;CR&gt;&quot;'

let g:formatters_c = ['my_custom_c']
let g:formatdef_my_custom_c = '&quot;astyle --mode=c --style=kr -T4 -N -U -y -p -xg -H -k3 -j -xb -m0 -M40 -n -xC100\&lt;CR&gt;&quot;'


&quot;*****************************************************
&quot;                                                    *
&quot; YouCompleteMe                                      *
&quot;                                                    *
&quot;*****************************************************
&quot;let g:ycm_use_clangd = 0
&quot;let g:ycm_global_ycm_extra_conf ='~/.vim/plugged/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'
&quot;let g:ycm_confirm_extra_conf = 0
&quot;let g:ycm_seed_identifiers_with_syntax=1
&quot;let g:ycm_error_symbol = 'E&gt;'
&quot;let g:ycm_warning_symbol = 'W&gt;'
&quot;注释与字符串中的内容也用于补全
&quot;let g:ycm_collect_identifiers_from_comments_and_strings = 1 
&quot;在注释输入中也能补全
&quot;let g:ycm_complete_in_comments = 1                          
&quot;在字符串输入中也能补全
&quot;let g:ycm_complete_in_strings = 1                           
&quot;映射按键,没有这个会拦截掉tab, 导致其他插件的tab不能用.
&quot;let g:ycm_key_list_select_completion = ['&lt;c-n&gt;', '&lt;Down&gt;']  
&quot;let g:ycm_key_list_previous_completion = ['&lt;c-p&gt;', '&lt;Up&gt;']
&quot; 禁用语法检查
&quot;let g:ycm_show_diagnostics_ui = 0                           
&quot;
&quot;let g:ycm_semantic_triggers =  {
&quot;      \ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],
&quot;      \ 'cs,lua,javascript': ['re!\w{2}'],
&quot;      \}
&quot;
&quot;&quot;回车即选中当前项
&quot;inoremap &lt;expr&gt; &lt;CR&gt; pumvisible() ? &quot;\&lt;C-y&gt;&quot; : &quot;\&lt;CR&gt;&quot;
&quot;autocmd InsertLeave * if pumvisible() == 0|pclose|endif

&quot;&quot;****************************************************
&quot;                                                    *
&quot;octol/vim-cpp-enhanced-highlight                    *
&quot;                                                    *
&quot;*****************************************************
&quot;let g:cpp_class_scope_highlight = 1
&quot;let g:cpp_member_variable_highlight = 1
&quot;let g:cpp_concepts_highlight = 1
&quot;let g:cpp_experimental_simple_template_highlight = 1
&quot; 文件较大时使用下面的设置高亮模板速度较快，但会有一些小错误
&quot; let g:cpp_experimental_template_highlight = 1


&quot;&quot;****************************************************
&quot;                                                    *
&quot; UltiSnips                                          *
&quot;                                                    *
&quot;*****************************************************
&quot;let g:UltiSnipsExpandTrigger=&quot;&lt;C-j&gt;&quot;
&quot;let g:UltiSnipsListSnippets=&quot;&lt;C-e&gt;&quot;
&quot;let g:UltiSnipsJumpForwardTrigger=&quot;&lt;C-j&gt;&quot;
&quot;let g:UltiSnipsJumpBackwardTrgger=&quot;&lt;C-k&gt;&quot;

</code></pre>
                    
                    <HR width="100%" id="EOF">
		    <p style="color:#777;">Last modified on 2020-05-26</p>
                    
                </div>
            </div>
            
            
            <nav class="post-pagination">

                
                <a class="newer-posts">
			Next<br>No newer posts.
                </a>
                
                
                
                <a class="older-posts" href="https://dillyant.gitee.io/about/">
			Previous<br>关于
                </a>
                
            </nav>
            <div class="post-comment-wrapper">
                


<div id="gitalk-container"></div>






            </div>
        </div>
    </div>
</div>

            </div><div id="single-column-footer">
Hugo Theme <a href="https://github.com/amazingrise/hugo-theme-diary">Diary</a> by <a href="https://amazingrise.net">Rise</a>
<br>
Ported from <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopener">Makito</a>'s <a href="https://github.com/SumiMakito/hexo-theme-journal/" target="_blank" rel="noreferrer noopener">Journal.</a> <br>
<br>

&copy;
	
	dillyant copyright.
	
</div>
            </div>
    <script>
let app;

app = new Vue({
    el: '#app',
    data: {
        scrollY: 0,
        navOpacity: 0,
        isDrawerOpen: false,
        mounted: false,
        isDarkMode: false
    },
    methods: {
            sgn(t, x) {
                let k = 1. / (1. - 2 * t);
                if (x <= t) return 0;
                else if (x >= 1 - t) return 1;
                else {
                    return k * (x - t);
                }
            },
            handleScroll() {
                this.scrollY = window.scrollY;
                this.navOpacity = this.sgn(.0, Math.min(1, Math.max(0, window.scrollY / (this.pageHeadHeight() - this.navBarHeight() * 0.8))));
                const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs;

                if (this.navOpacity >= 1) {
                    navBackground.style.opacity = 1;
                    navTitle.style.opacity = 1;
                } else {
                    navBackground.style.opacity = 0;
                    navTitle.style.opacity = 0;
                }
            },
            handleResize() {
                const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs;
                extraContainer.style.left = (streamContainer.offsetWidth - extraContainer.offsetWidth) + 'px';
            },
            navBarHeight() {
                return this.$refs.navBar.offsetHeight;
            },
            pageHeadHeight() {
                return this.$refs.pageHead.offsetHeight;
            },
            toggleDrawer() {
                this.isDrawerOpen = !this.isDrawerOpen;
                document.getElementsByTagName('html')[0].style.overflow = this.isDrawerOpen ? 'hidden' : 'unset';
            },
            closeDrawer() {
                this.isDrawerOpen = false;
                document.getElementsByTagName('html')[0].style.overflow = this.isDrawerOpen ? 'hidden' : 'unset';
            },
            toggleDarkMode() {
                this.isDarkMode = !this.isDarkMode;
                if (this.isDarkMode==true){
                    document.cookie = "night=1;path=/";
                    document.body.classList.add("night");
                } else {
                    document.cookie = "night=0;path=/";
                    document.body.classList.remove("night");
                }
            }
    },
    created() {
        window.addEventListener('scroll', this.handleScroll);
        window.addEventListener('resize', this.handleResize);
        window._nonDesktop = function () {
            let check = false;
            (function (a) {
                if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true;
            })(navigator.userAgent || navigator.vendor || window.opera);
            return check;
        };
        
        var night = document.cookie.replace(/(?:(?:^|.*;\s*)night\s*\=\s*([^;]*).*$)|^.*$/, "$1");
        if (night==""){
            if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
                
            }
        }else{
            
            if (night=="1") {
                this.toggleDarkMode();
            }
        }
    },
    mounted() {
        this.handleScroll();
        this.handleResize();
        this.mounted = true;

        
    },
    destroyed() {
        window.removeEventListener('scroll', this.handleScroll);
        window.removeEventListener('resize', this.handleResize);
    }
});
</script>

<script src="https://dillyant.gitee.io//js/journal.js"></script>
    </body>
</html>
